package com.azthink.chapter311.controller;

import com.azthink.chapter311.domain.Movie;
import com.azthink.chapter311.domain.Role;
import com.azthink.chapter311.service.MovieService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/movie")
public class MovieController {
    private static Logger logger = LoggerFactory.getLogger(MovieController.class);
    @Autowired
    private MovieService movieService;

    @RequestMapping("/get")
    public String get(){
        Movie movie = movieService.get("西游记");
        logger.info("===movie=== movie:{}, {}",movie.getName(), movie.getCreateDate());
        for(Role role : movie.getRoles()){
            logger.info("====== actor:{}, role:{}", role.getActor().getName(), role.getName());
        }
        return "";

    }
}
